<template>
  <el-dialog :title="title" :close-on-click-modal="false" :fullscreen="true" :visible.sync="visible"
    :before-close="cancel" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="50%">
    <el-row class="JNPF-common-search-box" :gutter="16">
      <el-form @submit.native.prevent ref="elForm" :model="dataForm" :rules="rules">

        <el-col :span="8">
          <el-form-item label="设备类型" prop="FSTNAME">
            <el-input v-model="dataForm.FSTNAME"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="用电量" prop="F01">
            <el-input v-model="dataForm.F01"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="同比" prop="F02">
            <el-input v-model="dataForm.F02"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="环比" prop="F03">
            <el-input v-model="dataForm.F03"  disabled />
          </el-form-item>
        </el-col>

        
        <el-col :span="5">
          <el-form-item label="">
            <!-- <el-button type="success" icon="el-icon-plus" @click="insert">添加场地</el-button> -->
            <el-button type="primary" :loading="loading">返回</el-button>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>

    <el-table :data="list1" border stripe>
          <el-table-column prop="FENTRYID" label="序号" ></el-table-column>
          <el-table-column prop="FPOINT" label="场地名称" ></el-table-column>
          <el-table-column prop="FSTNAME" label="设备名称"></el-table-column>
          <el-table-column prop="F01" label="用电量" ></el-table-column>
          <el-table-column prop="F02" label="环比量" ></el-table-column>
          <el-table-column prop="F03" label="同比量" ></el-table-column>
    </el-table>

    <StudqueryFcuston ref="StudqueryFcuston" @confirm="shoplist" />
  </el-dialog>
</template>
<script>
  import StudqueryFcuston from "@/components/StudqueryFcuston/StudqueryFcuston.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    components: { StudqueryFcuston },
    props: {
      formationlist: {
        type: Array,
        default: [],
      },
    },
    data() {
      return {
        checked1: true,
        checked2  : true,
        activeName: 'first',

        title: "新增",
        insertorupdate: true,
        dataForm: {
            FSTNAME: "室内空气",
            F01: 219.8,
            F02: 187.5,
            F03: 98.5 ,
            FOPERATOR: "system",
            FUPDDATE: "2011-02-16T02:57:02.000+00:00"
        },
        rules: {
          FCATNAME:[
            { required: true, message: '请输入空气项目', trigger: 'blur' },
          ],
          FMINVALUE: [
            { required: true, message: '请输入起始值', trigger: 'blur' },
          ],
          FMAXVALUE: [
            { required: true, message: '请输入结束值', trigger: 'blur' },
          ],
        },

        list1: [{ "FENTRYID":1,
                  "FPOINT": "奉化学楼301",
                  "FSTNAME": "1#空调",
                  "F01": 100.9,
                  "F02": 90.45,
                  "F03": 12.34
                },
                { "FENTRYID":2,
                  "FPOINT": "奉化学楼301",
                  "FSTNAME": "2#空调",
                  "F01": 80.9,
                  "F02": 70.45,
                  "F03": 52.34
                }],
        
        loading: false,
        visible: false,

        //所属校区选择数据
        options1: [{
          value: '1',
          label: '室外:PM2.5'
        }, {
          value: '2',
          label: '室外:PM10'
        }, {
          value: '3',
          label: '室内:温度'
        }],

        options2: [{
          value: '1',
          label: '全部'
        }, {
          value: '2',
          label: '教学楼'
        }, {
          value: '3',
          label: '教室'
        }],

        options3: [{
          value: '1',
          label: '未确认'
        }, {
          value: '2',
          label: '已确认'
        }, {
          value: '3',
          label: '已作废'
        }],

        options4: [{
          value: '1',
          label: '低风险'
        }, {
          value: '2',
          label: '中风险'
        }, {
          value: '3',
          label: '高风险'
        }, {
          value: '4',
          label: '重大风险'
        }],
        
      };
    },
    created() {
    },
    mounted() { },
    methods: {
      //
      init(FBILLNO) {
        this.dataForm.FBILLNO = FBILLNO;
        if (this.dataForm.FBILLNO) {
          this.title = "查看详情"
          this.insertorupdate = false;
        }
        else {
          this.title = "新增"
          this.dataForm.FBILLNO = "K" + Math.floor(Math.random() * 10000000) + 1;
          this.insertorupdate = true;
        }
        this.visible = true;
      },
      insert() {
        this.$refs.StudqueryFcuston.open();
      },
      shoplist(data) {
        data.forEach(item => {
          this.list.push({
            FBILLNO: this.dataForm.FBILLNO
            , FENTRYID: "1"
            , FYEAR: 2024
            , FGRADE: "大一"
            , FCLASS: "化学系1班"
            , FSTUDNAME: "曹操"
          },{
            FBILLNO: this.dataForm.FBILLNO
            , FENTRYID: "2"
            , FYEAR: 2024
            , FGRADE: "大一"
            , FCLASS: "化学系1班"
            , FSTUDNAME: "刘备"
          })
        });
      },
      //
      cancel() {
        this.$refs.elForm.resetFields();
        this.list = [];
        this.visible = false;
      },
    },
  };
</script>